<?php

namespace App\Models\V1;

use App\Models\ChannelCopyright;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Relations\HasOne;

class Notice extends BaseModel
{
    use HasFactory;
    protected $table="notice";
    protected $fillable=['title','content','state','remark','notice_class_id','preparatory_id','community_id','community_name','preparatory_name'];

    public function getStateAttribute()
    {
        return (string)$this->attributes['state'];
    }

    public function NoticeClass(): HasOne
    {
        return $this->hasOne(NoticeClass::class, 'id', 'notice_class_id');
    }

}
